<?php

// 6/30/2010: immanuel192 write this action for manage emails

if (!defined('EXPONENT')) exit('');
global $db;

if (exponent_permissions_check(array("administrate", "manage"),$loc)) { // for adminsitrator only
	exponent_flow_set(SYS_FLOW_PROTECTED,SYS_FLOW_ACTION);
	
	$emails=$db->selectObjects("mailinglist");
	
	$email_row=count($emails);
	if ($email_row % 2 == 1)
		{
			$email_row = $email_row /2+1;
			// put one email into array
			$temp=null;
			$temp->email="";
			$emails[]=$temp;
		}
	else
		$email_row=$email_row/2;
	
	$template = new template('mailinglistmodule','_manager_email',$loc);
	$template->assign('emails',$emails);
	$template->assign('email_row',$email_row);
	$template->output();
}
else
{
	echo SITE_404_HTML;	
}
?>
